package com.bit.springiocdemo.controller;

import com.bit.springiocdemo.model.UserInfo;
import com.bit.springiocdemo.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@ResponseBody
@Controller
public class UserController {
    @Autowired
    private  UserService userService;

//    @Autowired
//    @Qualifier("user2")
    @Resource(name = "user2")
    private UserInfo userInfo;

    @Autowired
    private ApplicationContext context;


    public void sayHi() {
        userService.doService();
        System.out.println(userInfo);
        System.out.println("UserController.sayHi");
    }

    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }
}
